/*进程等待*/
public class Demo11 {
    public static void main(String[] args) throws InterruptedException {
        Thread t =new Thread(()->{
            for(;;){
                System.out.println("hello thread");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    break;
                }
            }
        });
        t.start();

        //主线程中，可以对t线程进行“等待”
        System.out.println("主线程等待之前");
        //由于join也可能触发阻塞，就可能会抛出InterruptedException异常
        t.join();
        System.out.println("主线程等待之后");
    }
}
